/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Utility.CustomTag;

import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.SimpleTagSupport;

/**
 *
 * @author chickencake1
 */
public class DaySelectorTag extends SimpleTagSupport{
    private String day;
    
    public void setDay(String day)
    {
        this.day=day;
    }
    private void Writeout() throws JspException, IOException
    {
        int title;
        int d=35;
        if(day=="")
            title=0;
        else{
            d = Integer.parseInt(day);}
        JspWriter out = getJspContext().getOut();
        out.println("<select name=\"day\">");
        for(int i=0;i<32;i++)
        {
            if(i==d)
            {
                out.println("<option selected>"+d+"</option>");
            }
            else
            {
                if(i==0)
                    out.println("<option value=\"\">"+"chọn ngày"+"</option>");
                else
                    out.println("<option>"+i+"</option>");
            }
                
        }
        out.println("</select>");
                
    }

    @Override
    public void doTag() throws JspException, IOException {
        this.Writeout();
    }
    
}
